package com.huawei.appmarket.service.infoflow.view.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.ScaleAnimation;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import java.lang.ref.WeakReference;
import o.dky.h;
import o.dky.i;
import o.kn;

public class TopTipsView extends LinearLayout {
    private TextView ˋ;

    static class d implements Runnable {
        private WeakReference<TopTipsView> ˊ;
        private AnimationListener ˏ;

        public d(TopTipsView topTipsView, AnimationListener animationListener) {
            this.ˊ = new WeakReference(topTipsView);
            this.ˏ = animationListener;
        }

        public void run() {
            if (this.ˊ != null) {
                TopTipsView topTipsView = (TopTipsView) this.ˊ.get();
                if (topTipsView != null) {
                    topTipsView.ˎ(this.ˏ);
                }
            }
        }
    }

    static class e implements Runnable {
        private WeakReference<TopTipsView> ˏ;

        public e(TopTipsView topTipsView) {
            this.ˏ = new WeakReference(topTipsView);
        }

        public void run() {
            if (this.ˏ != null) {
                TopTipsView topTipsView = (TopTipsView) this.ˏ.get();
                if (topTipsView != null) {
                    topTipsView.ˊ();
                }
            }
        }
    }

    public TopTipsView(Context context) {
        super(context);
        ˊ(context);
    }

    public TopTipsView(Context context, @Nullable AttributeSet attributeSet) {
        super(context, attributeSet);
        ˊ(context);
    }

    public TopTipsView(Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        ˊ(context);
    }

    private void ˊ(Context context) {
        LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -2);
        View inflate = LayoutInflater.from(context).inflate(i.ʽॱ, null);
        addView(inflate, layoutParams);
        this.ˋ = (TextView) inflate.findViewById(h.ʼˋ);
        ˎ(null);
    }

    public void setTips(String str) {
        if (this.ˋ != null) {
            this.ˋ.setText(str);
        }
    }

    public void ॱ(AnimationListener animationListener) {
        postDelayed(new e(this), 300);
        postDelayed(new d(this, animationListener), 1500);
    }

    private void ˊ() {
        ˏ(0.0f, 1.0f, 300, null);
    }

    private void ˎ(AnimationListener animationListener) {
        ˏ(1.0f, 0.0f, 300, animationListener);
    }

    private void ˏ(float f, float f2, int i, AnimationListener animationListener) {
        Animation scaleAnimation = new ScaleAnimation(1.0f, 1.0f, f, f2);
        scaleAnimation.setInterpolator(new kn());
        scaleAnimation.setDuration((long) i);
        scaleAnimation.setFillEnabled(true);
        scaleAnimation.setFillAfter(true);
        scaleAnimation.setAnimationListener(animationListener);
        startAnimation(scaleAnimation);
    }
}
